<template>
  <el-form :model="form">
    <el-form-item label="回访途径" :label-width="formLabelWidth">
      <el-select v-model="form.diameter" placeholder="Select" style="width: 100%">
        <el-option
          v-for="item in options"
          :key="item.value"
          :label="item.label"
          :value="item.value"
        />
      </el-select>
    </el-form-item>
    <el-form-item label="状态" :label-width="formLabelWidth">
      <el-select v-model="form.status" placeholder="Select" style="width: 100%">
        <el-option
          v-for="item in options"
          :key="item.value"
          :label="item.label"
          :value="item.value"
        />
      </el-select>
    </el-form-item>
    <el-form-item label="回访级别" :label-width="formLabelWidth">
      <el-select v-model="form.level" placeholder="Select" style="width: 100%">
        <el-option
          v-for="item in options"
          :key="item.value"
          :label="item.label"
          :value="item.value"
        />
      </el-select>
    </el-form-item>
    <el-form-item label="主题" :label-width="formLabelWidth">
      <el-input v-model="form.name" placeholder="请输入回访主题"></el-input>
    </el-form-item>
    <el-form-item label="回访内容" :label-width="formLabelWidth">
      <el-input v-model="form.description" type="textarea" />
    </el-form-item>
    <el-form-item label="跟进日期" :label-width="formLabelWidth">
      <el-date-picker
        v-model="form.followDate"
        type="date"
        placeholder="Pick a day"
        :size="sizeDatePicker"
      />
    </el-form-item>
    <el-form-item label="下次跟进" :label-width="formLabelWidth">
      <el-date-picker
        v-model="form.nextFollowDate"
        type="date"
        placeholder="Pick a day"
        :size="sizeDatePicker"
      />
    </el-form-item>
  </el-form>
  <span class="dialog-footer">
    <el-button @click="closeDialog('cancel')">取消</el-button>
    <el-button type="primary" @click="closeDialog('confirm')"> 确认 </el-button>
  </span>
</template>
<script lang="ts" setup>
import { reactive, ref, defineEmits, defineProps, PropType } from "vue";
interface formList {
  name:String;   //主题
  diameter: String;  //回访途径
  type:Number;  //回访类型
  status: Number;   //跟进状态
  current_time: Date ;  //跟进日期
  description: String;   //内容
  next_time: String;   //下次跟进
  level:Number;  //回访级别
}
const props = defineProps({
  form: Object as PropType<formList>,
});
const formLabelWidth = ref("140px");
const form = reactive({ ...props.form });
const sizeDatePicker = ref("default");
const options = reactive([
  {
    value: "",
    label: "",
  },
]);
const value1 = ref("");
const dialogFormVisible = ref(false);

const emit = defineEmits(["closeVisiteDialog"]);

const closeDialog = (operate: String) => {
  if (operate === "cancel") {
    emit("closeVisiteDialog", { operate });
  } else {
    emit("closeVisiteDialog", { operate, visitData: form });
  }
};
</script>
<style lang="scss" scoped></style>
